#ifndef __PMSQ_H__
#define __PMSQ_H__
#include <pthread.h>
#include "qlist.h"

typedef enum
{
    PRIORITY_FREE = 0,
    PRIORITY_HIGH,
    PRIORITY_MEDIUM,
    PRIORITY_LOW,
    PRIORITY_MAX
} Priority;

typedef struct {
    QNode* queues[PRIORITY_MAX];
    pthread_mutex_t mutex;
    pthread_cond_t not_empty;
    pthread_cond_t not_full;
    size_t free_queue_size;
} PriorityQueue;


typedef struct
{
    QNode *empty_queue;
    QNode *high_queue;
    QNode *low_queue;
    QNode *media_queue;
    size_t node_size;
} Priority_MQ;

#define QUEUE_SIZE 10

extern void pmq_init(PriorityQueue* pmq);
extern void pmq_enqueue(PriorityQueue* pmq, void *msg, size_t msg_size, int priority);
extern void *pmq_dequeue(PriorityQueue *pmq, int *data_size, int *priority);
extern void pmq_print(PriorityQueue* pmq);
extern void pmq_free(PriorityQueue pmq);
extern void pmq_destroy(PriorityQueue pmq);
extern void pmq_send(void *msg, size_t msg_size, int priority);
extern void pmq_enqueue(PriorityQueue *pmq, void *msg, size_t msg_size, int priority);

#endif